package com.gesee.zyspps.adapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;

import com.gesee.zys.R;
import com.gesee.zyspps.db.CmsPoints;
import com.gesee.zyspps.model.PointCount;

/**
 * 
* @ClassName: PointCountAdapter
* @Description: TODO(管点数量统计)
* @author fujianxiong
* @date 2015年9月6日 下午9:47:34
*
 */
public class PointCountAdapter extends BaseAdapter
{
    private Context mContext;
    private List<PointCount> list = new ArrayList<PointCount>();

    public PointCountAdapter(List<PointCount> list,Context ctx)
    {
        this.list = list;
        this.mContext = ctx;
    }

    public void setList(List<PointCount> list)
    {
        this.list = list;
    }

    public List<PointCount> getList()
    {
        return list;
    }

    public int getCount()
    {
        return list == null ? 0 : list.size();
    }

    public Object getItem(int position)
    {
        return list.get(position);
    }

    public long getItemId(int position)
    {
        return list.get(position).getId();
    }

    public View getView(final int position, View convertView, ViewGroup parent)
    {
        ViewHolder holder = null;
        if (convertView == null)
        {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.point_count, null);
            holder = new ViewHolder();
            holder.tvType = (TextView) convertView.findViewById(R.id.tvType);
            /*holder.tvHidePoint = (TextView) convertView.findViewById(R.id.tvHidePoint);
            holder.tvObviousPoint = (TextView) convertView.findViewById(R.id.tvObviousPoint);*/
            holder.tvCount = (TextView) convertView.findViewById(R.id.tvCount);
            convertView.setTag(holder);
        }
        else
        {
            holder = (ViewHolder) convertView.getTag();
        }
        
        PointCount point = (PointCount) getItem(position);
        holder.tvType.setText(point.getType());
        holder.tvCount.setText(point.getCount()+"");

        return convertView;
    }

    class ViewHolder
    {
        TextView tvType;
        /*TextView tvHidePoint;
        TextView tvObviousPoint;*/
        TextView tvCount;
    }

}
